﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace version1
{
    public class Map : Visible
    {
        public float scale=1.0f;

        public float Scale
        {
            get { return scale; }
            set { scale = value; }
        }
        public Map(ContentManager content, string str, Vector2 _TopLeft, Vector2 _Size)
        {
            TopLeft =_TopLeft;
            Size = _Size;
            Texture2D[] text = new Texture2D[1];
            
            text[0] = content.Load<Texture2D>("Image//"+str);

            sprite = new List<Sprite2D>();
            Sprite2D temp = new Sprite2D(text, _TopLeft);
            temp.Size = _Size;
            sprite.Add(temp);
            nsprite = 1;
        }
        public override void Draw(SpriteBatch spritebatch, GameTime gameTime)
        {
           
            if (Size.X != 0 )
            {
                sprite[0].Position = TopLeft * scale;
                Vector2 temp = sprite[0].Size;
                temp.X = temp.X * scale;
                temp.Y = temp.Y * scale;
                sprite[0].Size = temp;
            }
            base.Draw(spritebatch, gameTime);
        }
        public  void Update(GameTime gametime, int x,int y)
        {
            //sprite[0]. = new Vector2(sprite[0].Position.X + x, sprite[0].Position.Y+y);
            TopLeft = new Vector2(TopLeft.X-x,TopLeft.Y-y);
            sprite[0].Position = TopLeft * scale;
        }
       
    }
}
